<template>
    <div id="MyCode">
        <div class="header"><img class="return_img" src="@/assets/Return.png" style="width:.23rem;height:.4rem;" v-on:click="back">我的二维码</div>
        <div class="mycode">
            <div class="content">
                <div class="con_top">
                    <img class="img" :src="data.headImg" alt="">
                    <div class="con_name">
                        <p>{{ data.name }}</p>
                        <span>{{ userInfo.depName }}</span>
                    </div>
                </div>
                <div class="con_b">
                    <img :src="data.url" alt="" style="width:3.06rem;height:3.06rem">
                   
                </div>
                <p class="con_f">订酒店、办入住、退房发票实现一站式服务</p>
            </div>
        </div>
    </div>
</template>

<script>
import { XHeader } from "vux";
import { getCode } from "@/service/home.js";
import axios from "axios";
export default {
  components: {
    XHeader
  },
  data() {
    return {
      id: sessionStorage.id,
      data: "",
      userInfo: ""
    };
  },
  mounted() {
    this._getCode();
  },
  methods: {
    back() {
      this.$router.push("/my/MyInformation");
    },
    _getCode() {
      this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
      console.log(this.userInfo);
      var id = this.userInfo.id ? this.userInfo.id : 324;
      axios.post("/recommend/getCode?token=" + id).then(res => {
        this.data = res.data;
        console.log(this.data)
      });
    }
  }
};
</script>
<style scoped lang="less">
.mycode {
  background: #b4b4b4;
  padding-top: 1.4rem;
  min-height: 14rem;
  .content {
    width: 7rem;
    height: 8.8rem;
    background: #fff;

    border-radius: 0.1rem;
    display: inline-block;
    margin: 0 0.26rem;
    .con_top {
      margin: 0.5rem 0.5rem;
      .img {
        width: 1.28rem;
        display: inline-block;
        margin-right: 0.2rem;
        vertical-align: top;
      }
      .con_name {
        display: inline-block;
        p {
          font-size: 0.36rem;
          color: #000000;
          margin-top: 0.2rem;
        }
        span {
          color: #000000;
          font-size: 0.3rem;
        }
      }
    }
    .con_b {
      background-size: 100%;
      width: 5.5rem;
      height: 5.5rem;
      background: url(../../assets/mycode_bj.png) no-repeat;
      margin: 0.19rem 0.76rem;
      img {
        width: 3.42rem;
        height: 3.42rem;
        margin: 1.04rem;
      }
    }
    .con_f {
      font-size: 0.3rem;
      color: #a1a1a1;
      margin-left: 0.66rem;
    }
  }
}
</style>

